var _serviceURL = '/69mark/merchant';// 必须设置

$(function() {
	
	doPage(1);
	
});

function doPage(page){
	var name = $("#serchName").val();
	var shopId = $("#shopId").val();
	var state = $("#state").val();
	$.ajax({
   		type : "POST",
   		url : _serviceURL+"/toListAllPeople.do",
   		cache : false,
   		data : "pageNo="+page+"&pageSize=10&name="+name+"&shopId="+shopId+"&state="+state,
   		dataType : 'json',
   		success : function(data) {
   			var result = "";
   			for(var i=0;i<data.menuList.length;i++){

   				result += "<div class=\"individual-form-home_record-table-demo-display\">";
   				result += "<div class=\"individual-form-home_record-table-demo-display-state\">";
   				result += data.menuList[i].nickname;
   				result += "</div>";
   				result += "<div class=\"individual-form-home_record-table-demo-display-heading2\">";
   				result += data.menuList[i].intro;
   				result += "</div>";
   				result += "<div class=\"individual-form-home_record-table-demo-display-guanzhu\">";
   				result += data.menuList[i].followNumber;
   				result += "</div>";
   				result += "<div class=\"individual-form-home_record-table-demo-display-time\">";
   				result += data.menuList[i].createdTime.substring(0,10);
   				result += "</div>";
   				result += "<div class=\"individual-form-home_record-table-demo-display-operation\">";
   				result += "<div class=\"individual-form-home_record-table-demo-display-operation-modify\">";
   				result += "<a href=\""+_serviceURL+"/toPeopleInf.do?id="+data.menuList[i].bId+"\"target=\"_blank\">";
   				result += "查看";
   				result += "</a>";
   				//result += "<a href=\"javascript:;\">联系</a>";
   				result += "</div>";
   				result += "</div>";
   				result += "</div>";
   				
   			}
   			
   			$("#heightList").html(result);
   			$("#page_user").html(data.navi);
   			
   			//新增属性值赋值为空
   			$("#serchName").val("");
   		}
	})
}

//搜索
function serchName() {
	doPage(1);
}

function updateState(id,state){
	
	$.ajax({
        type:'POST',
        url:_serviceURL+'/updateCouponState.do',
        data:'id='+id+"&state="+state,
        dataType : 'json',
        success:function(data){
            if(data==1){
                doPage(1);
            }else{
                alert("修改失败");
            }
        }
    });
	
}



